import java.util.LinkedList;

public class TLinkedList {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        LinkedList<Integer> list2 = new LinkedList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        System.out.println(list);

        System.out.println("==============================");

        list.add(3,99);
        System.out.println(list);

        System.out.println("==============================");

        list2.add(9);
        list2.addAll(list);
        System.out.println(list2);

        System.out.println("===============================");

        list.remove();
        System.out.println(list);
        //删除列表中第一个遇到的元素
        list.removeLast();
        System.out.println(list);
        list.remove(4);
        System.out.println(list);

        System.out.println("================================");

        System.out.println(list.contains(99));
        System.out.println(list.contains(999));

        System.out.println("=================================");

        System.out.println(list.indexOf(99));

        System.out.println("=================================");

        System.out.println(list.subList(0, 2));
    }

}
